import request from '@/utils/request'

enum Api {
  list = '/patrolJobUav/loadList',
  save = '',
  edit = '',
  delete = '/patrolJobUav/delete',
  upload = '',
  import = '',
  export = ''
}

/**
 * 导入
 * @param data
 */
export const importXlsx = async (data: FormData) => {
  return await request.post(Api.import, {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 列表
 * @param data
 */
export const list = async (data: {
  pageNum: number
  pageSize: number
  name?: string
  status?: undefined | string
}) => {
  return await request.post<{
    list: any[]
    pageNum: number
    pageSize: number
    total: number
  }>(Api.list, { data })
}

/**
 * 删除
 * @param id
 */
export const delOne = async (params: { id: number }) => {
  return await request.delete(Api.delete, { params })
}
